$(function() {
	if (GBrowserIsCompatible()) {
		var gmapPage = document.getElementById("gmap-page");
		var gmapSmall = $('#gmap-small');
		var gmapBig = $('#gmap-big');
		var gmapKey = $('#gmap-key').text();
		var geocoder = new GClientGeocoder();
		var address = $('#address').text().replace(/^[\s\t\r\n]+/g, '').replace(/[\s\t\r\n]+$/g, '');
		function showAddress(address) {
			geocoder.getLatLng(
				address,
				function(point) {
					if (point) {
						gmapSmall.html('<img width="600px" height="300px" alt="" src="http://maps.google.com/staticmap?center=' + point.y + ',' + point.x + '&zoom=15&size=600x300&key=' + gmapKey + '&markers=' + point.y + ',' + point.x + '" />');
						gmapBig.html('<img width="600px" height="600px" alt="" src="http://maps.google.com/staticmap?center=' + point.y + ',' + point.x + '&zoom=13&size=600x600&key=' + gmapKey + '&markers=' + point.y + ',' + point.x + '" />');
						gmapPage.style.visibility = 'visible';
						$('#gmap-about-text').show();
					} else {
						gmapPage.style.display = 'none';
					}
				}
			);
		}
		showAddress(address);
	}
});
